package com.xnew.user.service.impl;

import com.github.pagehelper.PageHelper;
import com.xnew.bean.common.SysUserInfo;
import com.xnew.user.mapper.AuUserMapper;
import com.xnew.user.service.UserInfoService;
import com.xnew.utils.DataInput;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author: hexs
 * @Project: JavaLaity
 * @Pcakage: com.xnew.user.service.impl.UserInfoServiceImpl
 * @Date: 2022年06月15日 13:56
 * @Description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserInfoServiceImpl implements UserInfoService {

    @Resource
    private AuUserMapper auuUserMapper;

    /**
     * 个人用户模块查询列表
     * @param input
     * @return
     */
    @Override
    public List<SysUserInfo> selectUserList(DataInput input) {
        //使用PageHelper 进行分页处理
        PageHelper.startPage(input.getPageNum(), input.getPageSize());
        return auuUserMapper.selectUserList(input.getParam());
    }

    /**
     * 人员列表查询
     * @param input
     * @return
     */
    @Override
    public List<SysUserInfo> queryIndvUserList(DataInput input, SysUserInfo userInfo) {
        PageHelper.startPage(input.getPageNum(), input.getPageSize());
        Map param = input.getParam();
        param.put("userInfoNo", userInfo.getUserInfoNo());
        if(param.get("orgUserNo")!=null && param.get("orgUserNo").equals("1")){
            param.put("orgUserNo", "");
        }
        return auuUserMapper.queryIndvUserList(param);
    }
}
